import path from 'path'
import { app } from 'electron';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default (win, hash = '') => {
    const isPro = app.isPackaged; //生产环境
    if (isPro) {
        const entryPath = path.resolve(__dirname, 'web', 'index.html');
        win.loadFile(entryPath, { hash })
    } else {
        const entryPath = 'http://localhost:5173'+(hash?('#'+hash):hash);
        win.loadURL(entryPath)
    }
}